package com.swss.workFlow.dao;

import java.sql.SQLException;

import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
import org.springframework.orm.hibernate3.HibernateCallback;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

public class BasicDAO extends HibernateDaoSupport {

	@SuppressWarnings("unchecked")
	public Object findOneById(final Class class1,final Integer id) throws Exception {
		return getHibernateTemplate().execute(new HibernateCallback() {
			public Object doInHibernate(Session session)
					throws HibernateException, SQLException {
				
				return  session.createCriteria(class1).add(
						Restrictions.eq("id", id)).uniqueResult();
				
			}
		});

	};
}
